package com.ruoyi.business.enums;

import com.ruoyi.common.exception.ServiceException;
import lombok.Getter;

/**
 *
 */
public enum TaskAuditStatus {
    DRAFT(0, "待提交"),
    AUDIT(1, "待审核"),
    APPROVED(2, "通过"),
    REVIEW_REJECTION(3, "驳回");

    @Getter
    private final Integer key;
    @Getter
    private final String desc;

    TaskAuditStatus(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static TaskAuditStatus getByKey(Integer key) {
        for (TaskAuditStatus e : values()) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        throw new ServiceException("enum not exists.");
    }
}